from individual import Individual
from slave_tasks.dev import DevTask
from slave_tasks.eval import EvalATask, EvalBTask
from slave_tasks.feedback import FeedbackTask
import settings

#========
pop1 = []
for i in range(settings.POP_SIZE):
    pop1.append(Individual())
print "pop 1 size = " + str(len(pop1))

devTask = DevTask()
pop1 = devTask.__execute__(None, pop1)
print "done development!"

evalATask = EvalATask()
pop1 = evalATask.__execute__(None, pop1)
print "done eval A!"

evalBTask = EvalBTask()
pop1 = evalBTask.__execute__(None, pop1)
print "done eval B!"

feedbackTask = FeedbackTask()
pop1 = feedbackTask.__execute__(None, pop1)
print "done feedback!"

#========
pop2 = []
for ind in pop1:
    if ind.is_alive():
        pop2.append(ind)
print "pop 2 size = " + str(len(pop2))

devTask = DevTask()
pop2 = devTask.__execute__(None, pop2)
print "done development!"

evalATask = EvalATask()
pop2 = evalATask.__execute__(None, pop2)
print "done eval A!"

evalBTask = EvalBTask()
pop2 = evalBTask.__execute__(None, pop2)
print "done eval B!"

feedbackTask = FeedbackTask()
pop2 = feedbackTask.__execute__(None, pop2)
print "done feedback!"

#========